﻿using System;
using System.Windows.Forms;
using Office = Microsoft.Office.Core;
using OL = Microsoft.Office.Interop.Outlook;

namespace CDCOSDH
{
    public partial class CDCOSDHAddIn
    {
        private const string MESSAGE_BOX_CAPTION = "Convergens Domino Connector for SDH";

        private void ThisAddIn_Startup(object sender, System.EventArgs e)
        {
            try
            {
                ConvergensSettings.CDCOSettings.Instance.Load();
                Application.ItemSend += new OL.ApplicationEvents_11_ItemSendEventHandler(Application_ItemSend);
            }
            catch (Exception ex)
            {
                MessageBox.Show("CDCOSDH initialiseringfejl.\n\nSystem besked:\n" + ex.Message + "\n\n" + ex.StackTrace, MESSAGE_BOX_CAPTION, MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
        }

        private void Application_ItemSend(object Item, ref bool Cancel)
        {

        }

        protected override Microsoft.Office.Core.IRibbonExtensibility CreateRibbonExtensibilityObject()
        {
            return new RibbonCDCOSDH();
        }

        private void ThisAddIn_Shutdown(object sender, System.EventArgs e)
        {
        }

        #region VSTO generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InternalStartup()
        {
            this.Startup += new System.EventHandler(ThisAddIn_Startup);
            this.Shutdown += new System.EventHandler(ThisAddIn_Shutdown);
        }
        
        #endregion
    }
}
